package 第06枚举类;

public enum Color {
    RED(255,0,0,"红色"),BLUE(0,255,0,"蓝色"),GREEN(0,0,255,"绿色");
    private final  int r, g, b;//三原色
    private String description; //描述

    Color(int r, int g, int b, String description) {
        this.r = r;
        this.g = g;
        this.b = b;
        this.description = description;
    }

    public int getR() {
        return r;
    }

    public int getG() {
        return g;
    }

    public int getB() {
        return b;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return name()+"(" +r+","+g+","+b+")"+"->"+description;
    }
}
